﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using MxitAPI;

namespace MxitGUI {
    public partial class AddContactWindow : Form {
        public AddContactWindow() {
            InitializeComponent();
            Init();
        }

        private void Init() {

            int selectIndex = cmbContactType.Items.Add( ContactType.MXit );
            cmbContactType.Items.Add( ContactType.AIM );
            cmbContactType.Items.Add( ContactType.GoogleTalk );
            cmbContactType.Items.Add( ContactType.ICQ );
            cmbContactType.Items.Add( ContactType.Info );
            cmbContactType.Items.Add( ContactType.Jabber );
            cmbContactType.Items.Add( ContactType.MSN );
            cmbContactType.Items.Add( ContactType.Yahoo );
            cmbContactType.SelectedIndex = selectIndex;
           
        }

        private void btnAddContact_Click( object sender, EventArgs e ) {
            ContactType contactType = ( ContactType ) cmbContactType.SelectedItem;
            SubscribeToContactHandler handler = new SubscribeToContactHandler( txtGroup.Text, txtUserName.Text, txtNickName.Text, contactType, txtInviteMessage.Text );
            handler.Execute();
            DialogResult = DialogResult.OK;
            Close();
        }

        private void btnCancel_Click( object sender, EventArgs e ) {
            DialogResult = DialogResult.Cancel;
            Close();
        }
    }
}
